<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div id="app">
      <hello :name="person.name" :age="person.age" :sex="person.sex"></hello>

      <hr />

      <!-- 简写 -->
      <hello v-bind="person"></hello>
    </div>

    <script src="../lib/vue.js"></script>
    <script>
      Vue.component("hello", {
        template: `
          <div>{{ name }} - {{ age }} - {{ sex }} - {{ children }}</div>
        `,
        props: ["name", "age", "sex", "children"],
      });

      const vm = new Vue({
        el: "#app",
        data: {
          person: {
            name: "张三",
            age: 18,
            sex: "男",
            children: ["张小", "张大"],
          },
        },
      });
    </script>
  </body>
</html>
